package com.doyens.seckill.service;

import com.doyens.seckill.pojo.SeckillGoods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SeckillGoodsService {

    @Autowired
    private RedisTemplate redisTemplate;

    public List<SeckillGoods> list(String key){  // 14:00   16:00 18:00
        return  redisTemplate.boundHashOps("seckillGoods_"+key).values();
    }

    public SeckillGoods queryById(String time,Long id){
        return (SeckillGoods) redisTemplate.boundHashOps("seckillGoods_"+time).get(id);
    }
}
